from urllib.parse import quote_plus

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

from env_config import SF

engine = create_engine(
    f'mysql+pymysql://{SF.DB_USER}:{quote_plus(SF.DB_PASSWORD)}@{SF.DB_HOST}:{SF.DB_PORT}/{SF.DB_DEFAULT_DB}',
    pool_recycle=SF.DB_WAIT_TIMEOUT)

Session = sessionmaker(bind=engine)
